<template>

        <section class='loginCon'>
            <div class="title">
                <h1>请登录</h1>
                <p>请使用招商盾密码登录</p>
            </div>
            <div class="loginBox">  
                <ul>
                    <li>
                        <label>姓  名</label><input class="name" v-model.trim="name" placeholder="请输入姓名或编号" type="text" />
                    </li>
                    <li>
                        <label >密  码</label><input v-model.trim="pwd" placeholder="请输入招商盾密码" class="psw" type="password">
                    </li>
                    <li>
                        <button class="btn" @click="submitForm">登录</button>
                    </li>
                </ul>

            </div>
        </section>
</template>

<script>
import Bus from '@/common/js/vueBus.js';
  export default {
    name: 'login',
    data(){
    return {
      name:'',
      pwd:"",
    }
  },
  methods:{

    submitForm(){

      let params = {
        userid:this.name,
        password:this.pwd
      };
      // this.$refs.loginForm.submit()
      this.Axios.Post(
        this.URL.login.url,
        params
      ).then(function(res){
          if (res.data.status === 1) {
              var token = res.data.token;
              localStorage.setItem('token',token);
              Bus.$emit("login-succ",true);
              location.reload();
              // self.$router.push('/employeeServ?emplid='+id);
            //   location.href = '/module/leader.html?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxMDAwMDM5Iiwic3ViIjoiYzEwMDcxMDciLCJpc3MiOiJXWFAiLCJleHAiOjE1MTE5NTE4MTR9.hZtbkhE8S6_rqmOJk2pXFvqVelCDtdv58fg2UqeKYNg';
          } else {
            // if (res.data.datas.count >= 3) {
            //   self.ishidecode = true;
            // }
            // self.checkImgEve();
          }
      }).catch(function(err){
          console.log(err);
          // location.reload();
      })
  

    },

    //切换图片路径事件
    checkImgEve(){
      var self=this;
        console.log('img');
        self.Axios.Post(
        this.URL.createYZM.url).then(function(res){
        console.log(res,'img')
        self.checkImgSrc=res.data.datas;
        console.log(self.checkImgSrc);
      }).catch(function(err){
        console.log(err);
      });
    }
  },
  mounted(){
    // this.checkImgEve();
      
  }
  }
</script>

<style lang="less" scoped>
 
.loginCon{
    position:fixed;
    top:0;
    bottom:0;
    left:0;
    background: #fff;
    z-index: 3000;
    right:0;
    .title{
        padding:1rem 0.4rem;
        border-bottom: 1px solid #ccc;
        h1{
          font-size:0.48rem;
          font-weight: 600;
        }
        p{
          color:#666;
          height:0.8rem;
          line-height:0.8rem;
        }
    }
    .loginBox{
        li{
            line-height:1.2rem;
            height:1.2rem;
            font-size:0.36rem;
            input{
              text-align:right;
              width:64%;
              border:none;
              height:1.2rem;
              line-height:1.2rem;
              background-color:transparent;
              border:none;
              // margin-top:-0.1rem;
              padding:0 0;
              vertical-align:top;
              padding-right:0.4rem;
            }
            input.psw{

              font-size:0.42rem;
              // padding-right:0.2rem;
            }
            input.name{

              font-size:0.48rem;
              font-weight: 600; 
            }
            input::-webkit-input-placeholder{
                color: #888;
                font-size: 0.32rem;
                line-height:0.48rem;
                height:0.48rem;
                font-weight: normal;
                text-align:left;
            }
            input:focus{
              outline:none;
            }
            label{
              display: inline-block;
              width:28%;
              padding-left:0.36rem;
              text-align:left;
            }
            .btn{
              width:90%;
              height:0.8rem;
              background-color:#1AAC19;
              border-radius:0.1rem;
              color:#eee;
              border:none;
              font-size:0.42rem;
              line-height:0.8rem;
              text-align:center;
              margin:auto 5%;
            }
        }
        li:first-child{
          label{
            color:#666;
          }
        }
        
    }
}





</style>


